package class21To30;


import java.io.*;


public class QuickSort {

    public static final int MAX_N = 10005;

    private static int[] arr = new int[MAX_N];

    private static int n;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        in.nextToken();
        n = (int) in.nval;
        for (int i = 0; i < n; i++) {
            in.nextToken();
            arr[i] = (int) in.nval;
        }
        quickSort(0, n - 1);
        for (int i = 0; i < n - 1; i++) {
            out.print(arr[i] + " ");
        }
        out.println(arr[n - 1]);
        out.flush();
        out.close();
        br.close();
    }

    private static void quickSort(int l, int r) {
        if (l >= r) {
            return;
        }
        int x = arr[(int) (Math.random() * (r - l + 1) + l)];
        int[] tmp = partition(l, x, r);
        int left = tmp[0] - 1;
        int right = tmp[1] + 1;
        quickSort(l, left);
        quickSort(right, r);
    }

    private static int[] partition(int l, int x, int r) {
        int[] tmp = new int[2];
        int a = l;
        int i = l;
        int b = r;
        while (i <= b) {
            if (arr[i] == x) {
                i++;
            } else if (arr[i] < x) {
                swap(a++, i++);
            } else {
                swap(i, b--);
            }
        }
        tmp[0] = a;
        tmp[1] = b;
        return tmp;
    }

    public static void swap(int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}
